<template>
  <div>
    <auth-title @sendBack="$router.back()" text="精彩跟帖"></auth-title>
    <comment v-for="(item, index) in commentData" :key="index" :commentItem="item">
      <floor :floorItem="item.parent"></floor>
    </comment>

  </div>
</template>

<script>
import authTitle from '@/commonComponent/authTitle'
import Comment from '@/commonComponent/comment'
import Floor from '@/commonComponent/floor'
import newsDetailApi from '@/api/newsDetail'

export default {
  data() {
    return {
      commentData: []
    }
  },
  created() {
    this.getPostCommentData(this.$route.params.id)
  },
  methods: {
    getPostCommentData(id) {
      newsDetailApi.getPostComment(id).then(res => {
        let resp = res.data
        console.log(resp.data);
        this.commentData = resp.data
      })
    }
  },
  components: {
    authTitle,
    Comment,
    Floor
  }
}
</script>

<style scoped>
</style>
